package vn.lumi.smarthome.network;

import android.content.Context;
import android.os.Parcel;
import android.os.Parcelable;

public abstract class AppMsg extends NetMessage implements Parcelable{
	protected int user_id = 0;
	protected int session_id = 0;
	
	public AppMsg(){
		
	}
	public AppMsg(int cmd_id){
		super(cmd_id);
	}
	
	public AppMsg(int cmd_id, int Msg_id, int uid, int sid){
		super(cmd_id, Msg_id);
		user_id = uid;
		session_id = sid;
	}
	
	public AppMsg(int cmd_id, int Msg_id, int len, int uid, int sid){
		super(cmd_id, len, Msg_id);
		user_id = uid;
		session_id = sid;
	}
	
	public int getUid(){
		return user_id;
	}
	
	public int getSid(){
		return session_id;
	}
	
	public abstract byte[] generateByteArray();
	public abstract void doIfSendSuccessful(Context context);
	public abstract void doIfSendFail(Context context);
	public abstract void readFromParcel(Parcel in);
	public abstract boolean isCorrectReply(byte[] input, int length);
	public abstract boolean isCorrectBusy(byte[] input, int length);
	public abstract void doIfHcBusying();
}
